-- 菜单 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('商品评论', '2048', '1', 'comment', 'demo/comment/index', 1, 0, 'C', '0', '0', 'demo:comment:list', 'edit', 'admin', sysdate(), '', null, '商品评论菜单');

-- 按钮父菜单ID
SELECT @parentId := LAST_INSERT_ID();

-- 按钮 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('商品评论查询', @parentId, '1',  '#', '', 1, 0, 'F', '0', '0', 'demo:comment:query',        '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('商品评论新增', @parentId, '2',  '#', '', 1, 0, 'F', '0', '0', 'demo:comment:add',          '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('商品评论修改', @parentId, '3',  '#', '', 1, 0, 'F', '0', '0', 'demo:comment:edit',         '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('商品评论删除', @parentId, '4',  '#', '', 1, 0, 'F', '0', '0', 'demo:comment:remove',       '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('商品评论导出', @parentId, '5',  '#', '', 1, 0, 'F', '0', '0', 'demo:comment:export',       '#', 'admin', sysdate(), '', null, '');



-- ----------------------------
-- Table structure for auction_comment
-- ----------------------------
DROP TABLE IF EXISTS `auction_comment`;
CREATE TABLE `auction_comment` (
                                   `comment_id` bigint NOT NULL AUTO_INCREMENT COMMENT '评论ID',
                                   `goods_id` bigint NOT NULL COMMENT '商品ID',
                                   `user_id` bigint NOT NULL COMMENT '用户ID',
                                   `parent_id` bigint DEFAULT NULL COMMENT '父评论ID（回复评论时使用）',
                                   `content` varchar(500) NOT NULL COMMENT '评论内容',
                                   `comment_time` datetime DEFAULT NULL COMMENT '评论时间',
                                   `is_hidden` char(1) DEFAULT '0' COMMENT '是否隐藏（0显示 1隐藏）',
                                   `like_count` int DEFAULT '0' COMMENT '点赞数',
                                   `status` char(1) DEFAULT '0' COMMENT '状态（0正常 1停用）',
                                   `create_by` varchar(64) DEFAULT '' COMMENT '创建者',
                                   `create_time` datetime DEFAULT NULL COMMENT '创建时间',
                                   `update_by` varchar(64) DEFAULT '' COMMENT '更新者',
                                   `update_time` datetime DEFAULT NULL COMMENT '更新时间',
                                   `remark` varchar(500) DEFAULT NULL COMMENT '备注',
                                   PRIMARY KEY (`comment_id`),
                                   KEY `idx_goods` (`goods_id`),
                                   KEY `idx_user` (`user_id`),
                                   KEY `idx_parent` (`parent_id`)
) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='商品评论表';


-- ----------------------------
-- Records of auction_comment
-- ----------------------------
BEGIN;
INSERT INTO `auction_comment` (`comment_id`, `goods_id`, `user_id`, `parent_id`, `content`, `comment_time`, `is_hidden`, `like_count`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`)
VALUES
    (1, 1, 2, NULL, '这款商品非常不错，值得拍下！', '2025-02-24 18:15:20', '0', 5, '0', '', '2025-02-24 18:15:20', '', NULL, NULL),
    (2, 1, 3, NULL, '物美价廉，很满意这次的竞拍体验。', '2025-02-24 19:30:15', '0', 3, '0', '', '2025-02-24 19:30:15', '', NULL, NULL),
    (3, 1, 4, 1, '我也觉得，质量确实很好。', '2025-02-24 20:45:33', '0', 1, '0', '', '2025-02-24 20:45:33', '', NULL, NULL),
    (4, 2, 5, NULL, '卖家描述准确，实物和图片一致。', '2025-02-25 10:12:45', '0', 7, '0', '', '2025-02-25 10:12:45', '', NULL, NULL),
    (5, 3, 6, NULL, '物流很快，包装也很好。', '2025-02-25 14:23:18', '0', 2, '0', '', '2025-02-25 14:23:18', '', NULL, NULL),
    (6, 3, 7, 5, '请问发货时间大概是什么时候？', '2025-02-25 15:40:22', '0', 0, '0', '', '2025-02-25 15:40:22', '', NULL, NULL),
    (7, 3, 6, 6, '竞拍成功后三天内发货。', '2025-02-25 16:05:47', '0', 1, '0', '', '2025-02-25 16:05:47', '', NULL, NULL),
    (8, 4, 8, NULL, '这个商品是正品吗？', '2025-02-26 09:30:11', '0', 0, '0', '', '2025-02-26 09:30:11', '', NULL, NULL),
    (9, 4, 9, 8, '我买过，确认是正品，可以放心购买。', '2025-02-26 10:45:38', '0', 4, '0', '', '2025-02-26 10:45:38', '', NULL, NULL),
    (10, 5, 10, NULL, '这款商品性价比很高。', '2025-02-26 13:22:56', '0', 8, '0', '', '2025-02-26 13:22:56', '', NULL, NULL),
    (11, 5, 11, NULL, '有点失望，实物比图片展示的差一些。', '2025-02-26 15:18:33', '1', 0, '0', '', '2025-02-26 15:18:33', '', NULL, NULL),
    (12, 6, 12, NULL, '拍卖过程很紧张刺激，最后还是拍到了心仪的商品。', '2025-02-27 11:05:42', '0', 12, '0', '', '2025-02-27 11:05:42', '', NULL, NULL);
COMMIT;
